﻿//创建时间: 2010-10-22
//创建作者: 李 城
//功能说明: 数据处理接口         
//最后修改: 2010-10-25
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace TRPOP.CMS.Plugin
{
    /// <summary>
    /// 数据处理接口
    /// </summary>
    public interface IDAL
    {
        /// <summary>
        /// 自动分页单页内容长度
        /// </summary>
        /// <returns></returns>
        int GetAtuoContentCut();


        /// <summary>
        ///  获得模板变量
        /// </summary>
        /// <param name="strVarKey"></param>
        /// <returns></returns>
        string GetTemplateVar(string strVarKey);


        /// <summary>
        /// 根据nodeid获取 附加发布列表
        /// </summary>
        /// <param name="strNodeids"></param>
        /// <param name="blnCache"></param>
        /// <param name="strReturnkey"></param>
        /// <returns>必须返回的字段:【PublishID 附加发布ID】【PublishName  发布名称】【NodeID 所属结点ID号】【PublishFileName 发布文件名 】【Intro 附加注释 】【URL 附加发布的发布URL】</returns>
        DataTable GetExtraPublish(string strNodeids, bool blnCache, string strReturnkey);

        /// <summary>
        ///  根据 Indexids 获取内容列表，如果多条数据则返回Datatable，如果一条则返回DataRow
        ///  如果blnDatatTable是true，则强制返回DataTable
        /// </summary>
        /// <param name="strIndexids">内容ids</param>
        /// <param name="blnCache">是否启用缓存</param>
        /// <param name="blnDatatTable">是否强制返回Datatable</param>
        /// <param name="strReturnkey">返回的关键字</param>
        /// <returns></returns>
        object GetContent(string strIndexids, bool blnCache, bool blnDatatTable, string strReturnkey);

        /// <summary>
        /// 内容页提取当前内容时使用，将已得到的数据源里的主内容字段图片进行转换，增加图片类型集合字段,这样可适用于多种类型的页面
        /// </summary>
        /// <param name="strIndexids"></param>
        /// <returns></returns>
        DataTable GetContentWithImgResource(string strIndexids);

        /// <summary>
        /// 根据 NodeID 或 NodeGUID 获得所有的某结点下的所有子结点列表     实现结点列表的调用
        /// </summary>
        /// <param name="blnNodeguid">据此判断strNodeguid是否是Nodeguid，否则则为nodeid的结合，例如1,2,3</param>
        /// <param name="strNodeguid"></param>
        /// <param name="strOrderby"></param>
        /// <param name="strIgnore"></param>
        /// <param name="blnCache"></param>
        /// <param name="strReturnkey"></param>
        /// <returns>必须返回的字段:【NodeID 结点ID】【TableID  结点归属的内容模型ID】【NodeName(Name) 结点名称】【NodeURL(URL) 结点首页URL地址 】【SubNodeID 所有子结点的ID串，比如'1%2%8%9%10%11%' 】【parentNodeID 父结点ID】【Navigation 结点当前位置的2维数组】</returns>
        DataTable GetNodeListBySub(bool blnNodeguid, string strNodeguid, string strOrderby, string strIgnore, bool blnCache, string strReturnkey);

        /// <summary>
        /// 根据 NodeID 或 NodeGUID 获得结点集合     实现结点列表的调用
        /// </summary>
        /// <param name="blnNodeguid">据此判断strNodeguid是否是Nodeguid，否则则为nodeid的结合，例如1,2,3</param>
        /// <param name="strNodeguid"></param>
        /// <param name="strOrderby"></param>
        /// <param name="strIgnore"></param>
        /// <param name="blnCache"></param>
        /// <param name="strReturnkey"></param>
        /// <returns>必须返回的字段:【NodeID 结点ID】【TableID  结点归属的内容模型ID】【NodeName(Name) 结点名称】【NodeURL(URL) 结点首页URL地址 】【SubNodeID 所有子结点的ID串，比如'1%2%8%9%10%11%' 】【parentNodeID 父结点ID】【Navigation 结点当前位置的2维数组】</returns>
        DataTable GetNodeListBySet(bool blnNodeguid, string strNodeguid, string strOrderby, string strIgnore, bool blnCache, string strReturnkey);

        /// <summary>
        /// 根据 NodeID 或 NodeGUID 获取所有的父节点集合      实现结点列表的调用
        /// </summary>
        /// <param name="blnNodeguid">据此判断strNodeguid是否是Nodeguid，否则则为nodeid的结合，例如1,2,3</param>
        /// <param name="strNodeguid"></param>
        /// <param name="strOrderby"></param>
        /// <param name="strIgnore"></param>
        /// <param name="blnCache"></param>
        /// <param name="strReturnkey"></param>
        /// <returns>必须返回的字段:【NodeID 结点ID】【TableID  结点归属的内容模型ID】【NodeName(Name) 结点名称】【NodeURL(URL) 结点首页URL地址 】【SubNodeID 所有子结点的ID串，比如'1%2%8%9%10%11%' 】【parentNodeID 父结点ID】【Navigation 结点当前位置的2维数组】</returns>
        DataTable GetNodeListByParent(bool blnNodeguid, string strNodeguid, string strOrderby, string strIgnore, bool blnCache, string strReturnkey);

        /// <summary>
        /// 根据 NodeID 或 NodeGUID 获取所有的同级结点集合      实现结点列表的调用
        /// </summary>
        /// <param name="blnNodeguid">据此判断strNodeguid是否是Nodeguid，否则则为nodeid的结合，例如1,2,3</param>
        /// <param name="strNodeguid"></param>
        /// <param name="strOrderby"></param>
        /// <param name="strIgnore"></param>
        /// <param name="blnCache"></param>
        /// <param name="strReturnkey"></param>
        /// <returns>必须返回的字段:【NodeID 结点ID】【TableID  结点归属的内容模型ID】【NodeName(Name) 结点名称】【NodeURL(URL) 结点首页URL地址 】【SubNodeID 所有子结点的ID串，比如'1%2%8%9%10%11%' 】【parentNodeID 父结点ID】【Navigation 结点当前位置的2维数组】</returns>
        DataTable GetNodeListByBrother(bool blnNodeguid, string strNodeguid, string strOrderby, string strIgnore, bool blnCache, string strReturnkey);

        /// <summary>
        /// 根据 NodeID 或 NodeGUID 获得所有的某结点下的所有子结点列表     实现结点列表的调用 等同 GetNodeListBySub
        /// </summary>
        /// <param name="blnNodeguid">据此判断strNodeguid是否是Nodeguid，否则则为nodeid的结合，例如1,2,3</param>
        /// <param name="strNodeguid"></param>
        /// <param name="strOrderby"></param>
        /// <param name="strIgnore"></param>
        /// <param name="blnCache"></param>
        /// <param name="strReturnkey"></param>
        /// <returns>必须返回的字段:【NodeID 结点ID】【TableID  结点归属的内容模型ID】【NodeName(Name) 结点名称】【NodeURL(URL) 结点首页URL地址 】【SubNodeID 所有子结点的ID串，比如'1%2%8%9%10%11%' 】【parentNodeID 父结点ID】【Navigation 结点当前位置的2维数组 DataTable】</returns>
        DataTable GetNodeListBySon(bool blnNodeguid, string strNodeguid, string strOrderby, string strIgnore, bool blnCache, string strReturnkey);

        /// <summary>
        /// 实现特定结点信息的调用
        /// </summary>
        /// <param name="blnNodeguid">据此判断strNodeguid是否是Nodeguid，否则则为nodeid的结合，例如1</param>
        /// <param name="strNodeguid"></param>
        /// <param name="blnCache"></param>
        /// <param name="strReturnkey"></param>
        /// <returns>必须返回的字段:【NodeID 结点ID】【TableID  结点归属的内容模型ID】【NodeName(Name) 结点名称】【NodeURL(URL) 结点首页URL地址 】【SubNodeID 所有子结点的ID串，比如'1%2%8%9%10%11%' 】【parentNodeID 父结点ID】【Navigation 结点当前位置的2维数组 DataTable】</returns>
        DataRow GetNodeInfo(bool blnNodeguid, string strNodeguid, bool blnCache, string strReturnkey);



        /// <summary>
        /// 根据 列表页中对文章评论内容的调用
        /// </summary>
        /// <param name="strIndexid"></param>
        /// <param name="strStart"></param>
        /// <param name="strNum"></param>
        /// <param name="blnHiddenIp"></param>
        /// <param name="blnCache"></param>
        /// <param name="strReturnkey"></param>
        /// <param name="strWhere"></param>
        /// <returns>必须返回的字段: 【CommentID】【IndexID】【NodeID】【ContentID】【Author】【CreationDate】【Ip】【Comment】</returns>
        DataTable GetCommentList(string strIndexid, string strStart, string strNum, bool blnHiddenIp, bool blnCache, string strReturnkey, string strWhere);

        int GetCommentCount(string strIndexid);



        /// <summary>
        ///  用于对指定条件范围的内容进行计算统计等操作，如求计数COUNT、求总和SUM、求平均数AVG等这些功能。主要使用Function这个属性来定义需要的操作动作函数，其它属性同CMS_LIST的属性
        /// </summary>
        /// <param name="strFunction"></param>
        /// <param name="strNodeid"></param>
        /// <param name="strTableid"></param>
        /// <param name="strWhere"></param>
        /// <param name="strQuery">此参数和where参数不能同时使用</param>
        /// <param name="bln"></param>
        /// <param name="strReturnkey"></param>
        /// <returns>返回值：一个字符串变量</returns>
        string GetCount(string strFunction, string strNodeid, string strTableid, string strWhere, string strQuery, bool blnCache, string strReturnkey);

        //SQL

        /// <summary>
        /// 实现对数据库的直接查询调用
        /// </summary>
        /// <param name="strQuery"></param>
        /// <param name="strNum"></param>
        /// <param name="blnCache"></param>
        /// <param name="strReturnkey"></param>
        /// <returns></returns>
        DataTable GetDatabySQLQuery(string strQuery, string strNum, bool blnCache, string strReturnkey);

        /// <summary>
        /// 获取执行sql返回的信息总数
        /// </summary>
        /// <param name="strQuery"></param>
        /// <param name="blnCache"></param>
        /// <param name="strReturnkey"></param>
        /// <returns></returns>
        int GetCountbySQLQuery(string strQuery, bool blnCache, string strReturnkey);

        //Search

        /// <summary>
        ///  根据结点id及其所有子节点、其他条件 获取 搜索列表
        /// </summary>
        /// <param name="strNodeids"></param>
        /// <param name="strNum"></param>
        /// <param name="strField"></param>
        /// <param name="strKeywords"></param>
        /// <param name="strSeparator"></param>
        /// <param name="strIgnorecontentid"></param>
        /// <param name="strWhere"></param>
        /// <param name="strOrderby"></param>
        /// <param name="blnExact"></param>
        /// <param name="blnCache"></param>
        /// <param name="strReturnkey"></param>
        /// <returns>必须返回的字段:【NodeID 】【ContentID  】【URL 】【IndexID 】【PublishDate】【TypeSort,i.Pink】【Sort】【Pink】【内容模型字段(N)】</returns>
        DataTable GetSearchWithAllSonByNodeid(string strNodeids, string strNum, string strField, string strKeywords, string strSeparator, string strIgnorecontentid, string strWhere, string strOrderby, bool blnExact, bool blnCache, string strReturnkey);

        int GetSearchWithAllSonByNodeid(string strNodeids, string strField, string strKeywords, string strSeparator, string strIgnorecontentid, string strWhere, bool blnExact, bool blnCache);

        /// <summary>
        ///  根据结点id、其他条件 获取 搜索列表
        /// </summary>
        /// <param name="strNodeids"></param>
        /// <param name="strNum"></param>
        /// <param name="strField"></param>
        /// <param name="strKeywords"></param>
        /// <param name="strSeparator"></param>
        /// <param name="strIgnorecontentid"></param>
        /// <param name="strWhere"></param>
        /// <param name="strOrderby"></param>
        /// <param name="blnExact"></param>
        /// <param name="blnCache"></param>
        /// <param name="strReturnkey"></param>
        /// <returns>必须返回的字段:【NodeID 】【ContentID  】【URL 】【IndexID 】【PublishDate】【TypeSort,i.Pink】【Sort】【Pink】【内容模型字段(N)】</returns>
        DataTable GetSearchByNodeid(string strNodeids, string strNum, string strField, string strKeywords, string strSeparator, string strIgnorecontentid, string strWhere, string strOrderby, bool blnExact, bool blnCache, string strReturnkey);

        int GetSearchByNodeid(string strNodeids, string strField, string strKeywords, string strSeparator, string strIgnorecontentid, string strWhere, bool blnExact, bool blnCache);

        /// <summary>
        ///  根据结点id、其他条件 获取 搜索列表
        /// </summary>
        /// <param name="strNodeids"></param>
        /// <param name="strNum"></param>
        /// <param name="strField"></param>
        /// <param name="strKeywords"></param>
        /// <param name="strSeparator"></param>
        /// <param name="strIgnorecontentid"></param>
        /// <param name="strWhere"></param>
        /// <param name="strOrderby"></param>
        /// <param name="blnExact"></param>
        /// <param name="blnCache"></param>
        /// <param name="strReturnkey"></param>
        /// <returns>必须返回的字段:【NodeID 】【ContentID  】【URL 】【IndexID 】【PublishDate】【TypeSort,i.Pink】【Sort】【Pink】【内容模型字段(N)】</returns>
        DataTable GetSearchByTableid(string strTableid, string strNum, string strField, string strKeywords, string strSeparator, string strIgnorecontentid, string strWhere, string strOrderby, bool blnExact, bool blnCache, string strReturnkey);

        int GetSearchByTableid(string strTableid, string strField, string strKeywords, string strSeparator, string strIgnorecontentid, string strWhere, bool blnExact, bool blnCache);

        //List

        /// <summary>
        ///  根据nodeid是获得数据集 各种类型的文章(图文)列表
        /// </summary>
        /// <param name="strNodeids"></param>
        /// <param name="strNum"></param>
        /// <param name="strOrderby"></param>
        /// <param name="strWhere"></param>
        /// <param name="strIgnore"></param>
        /// <param name="blnCache"></param>
        /// <param name="strReturnkey"></param>
        /// <param name="blnSubNodeid"></param>
        /// <returns>必须返回的字段:【IndexID 内容索引】【ContentID  内容ID】【NodeID int 归属结点ID 】【URL string 内容URL地址 】【PublishDate string 内容发布时间戳 】【Top int 置顶权重】【Sort int 排序权重】【Pink int 精华权重】【内容模型字段(N) - 根据具体的内容模型返回不同的字段值 】</returns>
        DataTable GetListByNodeids(string strNodeids, string strNum, string strOrderby, string strWhere, string strIgnore, bool blnCache, string strReturnkey, bool blnSubNodeid);

        int GetListByNodeids(string strNodeids, string strWhere, string strIgnore, bool blnCache, bool blnSubNodeid);

        /// <summary>
        /// 根据TableId是获得数据集 各种类型的文章(图文)列表
        /// </summary>
        /// <param name="strTableId"></param>
        /// <param name="strNum"></param>
        /// <param name="strOrderby"></param>
        /// <param name="strWhere"></param>
        /// <param name="strIgnore"></param>
        /// <param name="blnCache"></param>
        /// <param name="strReturnkey"></param>
        /// <param name="blnSubNodeid"></param>
        /// <returns>必须返回的字段:【IndexID 内容索引】【ContentID  内容ID】【NodeID int 归属结点ID 】【URL string 内容URL地址 】【PublishDate string 内容发布时间戳 】【Top int 置顶权重】【Sort int 排序权重】【Pink int 精华权重】【内容模型字段(N) - 根据具体的内容模型返回不同的字段值 】</returns>
        DataTable GetListByTableId(string strTableId, string strNum, string strOrderby, string strWhere, string strIgnore, bool blnCache, string strReturnkey);

        int GetListByTableId(string strTableId, string strWhere, string strIgnore, bool blnCache);


        /// <summary>
        /// 根据NodeGuid是获得数据集 各种类型的文章(图文)列表
        /// </summary>
        /// <param name="strNodeGuid"></param>
        /// <param name="strNum"></param>
        /// <param name="strOrderby"></param>
        /// <param name="strWhere"></param>
        /// <param name="strIgnore"></param>
        /// <param name="blnCache"></param>
        /// <param name="strReturnkey"></param>
        /// <param name="blnSubNodeid"></param>
        /// <returns>必须返回的字段:【IndexID 内容索引】【ContentID  内容ID】【NodeID int 归属结点ID 】【URL string 内容URL地址 】【PublishDate string 内容发布时间戳 】【Top int 置顶权重】【Sort int 排序权重】【Pink int 精华权重】【内容模型字段(N) - 根据具体的内容模型返回不同的字段值 】</returns>
        DataTable GetListByNodeGuid(string strNodeGuid, string strNum, string strOrderby, string strWhere, string strIgnore, bool blnCache, string strReturnkey);

        int GetListByNodeGuid(string strNodeGuid, string strWhere, string strIgnore, bool blnCache);

        /// <summary>
        /// PageSearch 搜索列表
        /// </summary>
        /// <param name="nodeid"></param>
        /// <param name="pageindex"></param>
        /// <param name="panenum"></param>
        /// <param name="key"></param>
        /// <param name="columns"></param>
        /// <param name="recordcount"></param>
        /// <returns></returns>
        DataTable GetPageSearchList(int nodeid, int pageindex, int panenum, string key, string columns, out int recordcount);

        /// <summary>
        /// GetPageAdvancedSearchList
        /// </summary>
        /// <param name="nodeid"></param>
        /// <param name="pageindex"></param>
        /// <param name="panenum"></param>
        /// <param name="key"></param>
        /// <param name="columns"></param>
        /// <param name="recordcount"></param>
        /// <returns></returns>
        DataTable GetPageAdvancedSearchList(int nodeid, int pageindex, int panenum, string key, string columns, out int recordcount);

        /// <summary>
        /// 资源表图片地址转换
        /// </summary>
        /// <param name="dicImage"></param>
        void ConvertToURLImagePath(Dictionary<string, string> dicImage);

     
        /// <summary>
        /// 获取图片压缩处理信息，不压缩图片，仅仅返回相关的压缩信息
        /// </summary>
        /// <param name="strphtotSrc"></param>
        /// <param name="strHttp"></param>
        /// <param name="strPhotoPath"></param>
        /// <returns></returns>
        bool autoMiniGetPhotoInfo(string strphtotSrc, ref string strHttp, ref string strPhotoPath);
        /// <summary>
        /// 根据http获取Psninfo
        /// </summary>
        /// <param name="strHttp"></param>
        /// <returns></returns>
        TRPOP.CMS.Model.PSNInfo GetInfoByHttp(string strHttp);
    }
}
